package com.xiu.json.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @Author: tjc
 * @description
 * @Date Created in 10:36 2022-04-03
 */
public class PrintTracer {
    private static ThreadLocal<List<String>> msgList = new ThreadLocal<>();

    static {
        msgList.set(new ArrayList<>());
    }

    public static void print(String msg) {
        List<String> msgs = msgList.get();
        msgs.add(msg);
        msgList.set(msgs);
    }

    public static List<String> getMsg() {
        return Collections.unmodifiableList(msgList.get());
    }
}
